gdk: Move GtkTargetList to GDK
authorBenjamin Otte <otte@redhat.com>
Fri, 17 Nov 2017 16:31:59 +0000 (17:31 +0100)
committerBenjamin Otte <otte@redhat.com>
Mon, 20 Nov 2017 22:12:33 +0000 (23:12 +0100)
It's gonna be renamed next, so put it in the right source file already.

For now retain the old name to keep the diff small.

gdk/gdk-autocleanup.h
gdk/gdk.h
gdk/gdkcontentformats.c [new file with mode: 0644]
gdk/gdkcontentformats.h [new file with mode: 0644]
gdk/gdkcontentformatsprivate.h [new file with mode: 0644]
gdk/meson.build
gtk/gtk-autocleanups.h
gtk/gtkselection.c
gtk/gtkselection.h

index 4941827663de5a2be88e42740a3e3fd1f7a583cd..76660c950b0e3b6fca2a1a28b1aebf454546643e 100644 (file)
@@ -33,6 +33,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkGLContext, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkKeymap, g_object_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkWindow, g_object_unref)
 
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTargetList, gtk_target_list_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkEvent, gdk_event_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameTimings, gdk_frame_timings_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkRGBA, gdk_rgba_free)
index fc18b7419ac77cf64c944d5c55efb3051d5240d4..296720ce41c120d79aa16536a220e65878848492 100644 (file)
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -31,6 +31,7 @@
 #include <gdk/gdkversionmacros.h>
 #include <gdk/gdkapplaunchcontext.h>
 #include <gdk/gdkcairo.h>
+#include <gdk/gdkcontentformats.h>
 #include <gdk/gdkcursor.h>
 #include <gdk/gdkdevice.h>
 #include <gdk/gdkdevicepad.h>
diff --git a/gdk/gdkcontentformats.c b/gdk/gdkcontentformats.c
new file mode 100644 (file)
index 0000000..00f87e4
--- /dev/null
@@ -0,0 +1,299 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* This file implements most of the work of the ICCCM selection protocol.
+ * The code was written after an intensive study of the equivalent part
+ * of John Ousterhout’s Tk toolkit, and does many things in much the 
+ * same way.
+ *
+ * The one thing in the ICCCM that isn’t fully supported here (or in Tk)
+ * is side effects targets. For these to be handled properly, MULTIPLE
+ * targets need to be done in the order specified. This cannot be
+ * guaranteed with the way we do things, since if we are doing INCR
+ * transfers, the order will depend on the timing of the requestor.
+ *
+ * By Owen Taylor <owt1@cornell.edu>         8/16/97
+ */
+
+/* Terminology note: when not otherwise specified, the term "incr" below
+ * refers to the _sending_ part of the INCR protocol. The receiving
+ * portion is referred to just as “retrieval”. (Terminology borrowed
+ * from Tk, because there is no good opposite to “retrieval” in English.
+ * “send” can’t be made into a noun gracefully and we’re already using
+ * “emission” for something else ....)
+ */
+
+/* The MOTIF entry widget seems to ask for the TARGETS target, then
+   (regardless of the reply) ask for the TEXT target. It's slightly
+   possible though that it somehow thinks we are responding negatively
+   to the TARGETS request, though I don't really think so ... */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+/**
+ * SECTION:gtkselection
+ * @Title: Selections
+ * @Short_description: Functions for handling inter-process communication
+ *     via selections
+ * @See_also: #GtkWidget - Much of the operation of selections happens via
+ *     signals for #GtkWidget. In particular, if you are using the functions
+ *     in this section, you may need to pay attention to
+ *     #GtkWidget::selection-get, #GtkWidget::selection-received and
+ *     #GtkWidget::selection-clear-event signals
+ *
+ * The selection mechanism provides the basis for different types
+ * of communication between processes. In particular, drag and drop and
+ * #GtkClipboard work via selections. You will very seldom or
+ * never need to use most of the functions in this section directly;
+ * #GtkClipboard provides a nicer interface to the same functionality.
+ *
+ * Some of the datatypes defined this section are used in
+ * the #GtkClipboard and drag-and-drop API’s as well. The
+ * #GtkTargetList object represents
+ * lists of data types that are supported when sending or
+ * receiving data. The #GtkSelectionData object is used to
+ * store a chunk of data along with the data type and other
+ * associated information.
+ */
+
+#include "config.h"
+
+#include "gdkcontentformats.h"
+#include "gdkcontentformatsprivate.h"
+
+#include "gdkproperty.h"
+
+struct _GtkTargetList
+{
+  /*< private >*/
+  GList *list;
+  guint ref_count;
+};
+
+
+/**
+ * gtk_target_list_new:
+ * @targets: (array length=ntargets) (allow-none): Pointer to an array
+ *   of char *
+ * @ntargets: number of entries in @targets.
+ * 
+ * Creates a new #GtkTargetList from an array of mime types.
+ * 
+ * Returns: (transfer full): the new #GtkTargetList.
+ **/
+GtkTargetList *
+gtk_target_list_new (const char **targets,
+                    guint        ntargets)
+{
+  GtkTargetList *result = g_slice_new (GtkTargetList);
+  result->list = NULL;
+  result->ref_count = 1;
+
+  if (targets)
+    gtk_target_list_add_table (result, targets, ntargets);
+  
+  return result;
+}
+
+/**
+ * gtk_target_list_ref:
+ * @list:  a #GtkTargetList
+ * 
+ * Increases the reference count of a #GtkTargetList by one.
+ *
+ * Returns: the passed in #GtkTargetList.
+ **/
+GtkTargetList *
+gtk_target_list_ref (GtkTargetList *list)
+{
+  g_return_val_if_fail (list != NULL, NULL);
+
+  list->ref_count++;
+
+  return list;
+}
+
+/**
+ * gtk_target_list_unref:
+ * @list: a #GtkTargetList
+ * 
+ * Decreases the reference count of a #GtkTargetList by one.
+ * If the resulting reference count is zero, frees the list.
+ **/
+void               
+gtk_target_list_unref (GtkTargetList *list)
+{
+  g_return_if_fail (list != NULL);
+  g_return_if_fail (list->ref_count > 0);
+
+  list->ref_count--;
+  if (list->ref_count > 0)
+    return;
+
+  g_list_free (list->list);
+  g_slice_free (GtkTargetList, list);
+}
+
+/**
+ * gtk_target_list_add:
+ * @list:  a #GtkTargetList
+ * @target: the mime type of the target
+ * 
+ * Appends another target to a #GtkTargetList.
+ **/
+void 
+gtk_target_list_add (GtkTargetList *list,
+                    const char    *target)
+{
+  g_return_if_fail (list != NULL);
+  
+  list->list = g_list_append (list->list, (gpointer) gdk_atom_intern (target, FALSE));
+}
+
+/**
+ * gtk_target_list_merge:
+ * @target: the #GtkTargetList to merge into
+ * @source: the #GtkTargeList to merge from
+ *
+ * Merges all targets from @source into @target.
+ */
+void
+gtk_target_list_merge (GtkTargetList       *target,
+                       const GtkTargetList *source)
+{
+  GList *l;
+
+  g_return_if_fail (target != NULL);
+  g_return_if_fail (source != NULL);
+
+  for (l = source->list; l; l = l->next)
+    {
+      target->list = g_list_prepend (target->list, l->data);
+    }
+}
+
+/**
+ * gtk_target_list_intersects:
+ * @first: the primary #GtkTargetList to intersect
+ * @second: the #GtkTargeList to intersect with
+ *
+ * Finds the first element from @first that is also contained
+ * in @second.
+ *
+ * Returns: The first matching #GdkAtom or %NULL if the lists
+ *     do not intersect.
+ */
+GdkAtom
+gtk_target_list_intersects (const GtkTargetList *first,
+                            const GtkTargetList *second)
+{
+  GList *l;
+
+  g_return_val_if_fail (first != NULL, NULL);
+  g_return_val_if_fail (second != NULL, NULL);
+
+  for (l = first->list; l; l = l->next)
+    {
+      if (g_list_find (second->list, l->data))
+        return l->data;
+    }
+
+  return NULL;
+}
+
+/**
+ * gtk_target_list_add_table:
+ * @list: a #GtkTargetList
+ * @targets: (array length=ntargets): the table of #GtkTargetEntry
+ * @ntargets: number of targets in the table
+ * 
+ * Prepends a table of #GtkTargetEntry to a target list.
+ **/
+void               
+gtk_target_list_add_table (GtkTargetList  *list,
+                          const char    **targets,
+                          guint           ntargets)
+{
+  gint i;
+
+  for (i=ntargets-1; i >= 0; i--)
+    {
+      list->list = g_list_prepend (list->list, (gpointer) gdk_atom_intern (targets[i], FALSE));
+    }
+}
+
+/**
+ * gtk_target_list_remove:
+ * @list: a #GtkTargetList
+ * @target: the interned atom representing the target
+ * 
+ * Removes a target from a target list.
+ **/
+void 
+gtk_target_list_remove (GtkTargetList *list,
+                       GdkAtom        target)
+{
+  g_return_if_fail (list != NULL);
+
+  list->list = g_list_remove (list->list, (gpointer) target);
+}
+
+/**
+ * gtk_target_list_find:
+ * @list: a #GtkTargetList
+ * @target: a string representing the target to search for
+ *
+ * Looks up a given target in a #GtkTargetList.
+ *
+ * Returns: %TRUE if the target was found, otherwise %FALSE
+ **/
+gboolean
+gtk_target_list_find (GtkTargetList *list,
+                     const char    *target)
+{
+  g_return_val_if_fail (list != NULL, FALSE);
+  g_return_val_if_fail (target != NULL, FALSE);
+
+  return g_list_find (list->list, (gpointer) gdk_atom_intern (target, FALSE)) != NULL;
+}
+
+GdkAtom *
+gtk_target_list_get_atoms (GtkTargetList *list,
+                           guint         *n_atoms)
+{
+  GdkAtom *atoms;
+  GList *l;
+  guint i, n;
+
+  n = g_list_length (list->list);
+  atoms = g_new (GdkAtom, n);
+
+  i = 0;
+  for (l = list->list; l; l = l->next)
+    atoms[i++] = l->data;
+
+  if (n_atoms)
+    *n_atoms = n;
+
+  return atoms;
+}
+
diff --git a/gdk/gdkcontentformats.h b/gdk/gdkcontentformats.h
new file mode 100644 (file)
index 0000000..39c7240
--- /dev/null
@@ -0,0 +1,80 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __GTK_CONTENT_FORMATS_H__
+#define __GTK_CONTENT_FORMATS_H__
+
+#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only <gdk/gdk.h> can be included directly."
+#endif
+
+
+#include <gdk/gdkversionmacros.h>
+#include <gdk/gdktypes.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GtkTargetList:
+ *
+ * A #GtkTargetList-struct is a reference counted list
+ * of #GtkTargetPair and should be treated as
+ * opaque.
+ */
+typedef struct _GtkTargetList  GtkTargetList;
+
+#define GTK_TYPE_TARGET_LIST    (gtk_target_list_get_type ())
+
+GDK_AVAILABLE_IN_ALL
+GType          gtk_target_list_get_type  (void) G_GNUC_CONST;
+GDK_AVAILABLE_IN_ALL
+GtkTargetList *gtk_target_list_new       (const char          **targets,
+                                          guint                 ntargets);
+GDK_AVAILABLE_IN_ALL
+GtkTargetList *gtk_target_list_ref       (GtkTargetList  *list);
+GDK_AVAILABLE_IN_ALL
+void           gtk_target_list_unref     (GtkTargetList  *list);
+GDK_AVAILABLE_IN_3_94
+void           gtk_target_list_merge     (GtkTargetList         *target,
+                                          const GtkTargetList   *source);
+GDK_AVAILABLE_IN_3_94
+GdkAtom        gtk_target_list_intersects(const GtkTargetList   *first,
+                                          const GtkTargetList   *second);
+GDK_AVAILABLE_IN_ALL
+void           gtk_target_list_add       (GtkTargetList  *list,
+                                          const char     *target);
+GDK_AVAILABLE_IN_ALL
+void           gtk_target_list_add_table (GtkTargetList        *list,
+                                          const char          **targets,
+                                          guint                 ntargets);
+GDK_AVAILABLE_IN_ALL
+void           gtk_target_list_remove    (GtkTargetList  *list,
+                                          const char     *target);
+GDK_AVAILABLE_IN_ALL
+gboolean       gtk_target_list_find      (GtkTargetList  *list,
+                                          const char     *target);
+
+G_END_DECLS
+
+#endif /* __GTK_CONTENT_FORMATS_H__ */
diff --git a/gdk/gdkcontentformatsprivate.h b/gdk/gdkcontentformatsprivate.h
new file mode 100644 (file)
index 0000000..b8f0a87
--- /dev/null
@@ -0,0 +1,33 @@
+/* GTK - The GIMP Toolkit
+ *
+ * Copyright (C) 2017 Benjamin Otte
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef __GTK_CONTENT_FORMATS_PRIVATE_H__
+#define __GTK_CONTENT_FORMATS_PRIVATE_H__
+
+#include "gdkcontentformats.h"
+
+G_BEGIN_DECLS
+
+GdkAtom *gtk_target_list_get_atoms      (GtkTargetList     *targets,
+                                         guint             *n_atoms);
+
+
+G_END_DECLS
+
+#endif /* __GTK_CONTENT_FORMATS_PRIVATE_H__ */
index 5b93ff85a4448f0fadec74c2aad1a3ffe8886956..9b34ee43951bfa4130935d5ed3f28d406b0ef407 100644 (file)
@@ -2,6 +2,7 @@ gdk_public_sources = files([
   'gdk.c',
   'gdkapplaunchcontext.c',
   'gdkcairo.c',
+  'gdkcontentformats.c',
   'gdkcursor.c',
   'gdkdevice.c',
   'gdkdevicemanager.c',
@@ -41,6 +42,7 @@ gdk_public_headers = files([
   'gdk.h',
   'gdkapplaunchcontext.h',
   'gdkcairo.h',
+  'gdkcontentformats.h',
   'gdkcursor.h',
   'gdkdevice.h',
   'gdkdevicemanager.h',
index ecddaf9e76ab663e985d2553b40b0d0e627727f3..75abbaaa5805a6f791d2f36b7922705556c21df8 100644 (file)
@@ -189,7 +189,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkVolumeButton, g_object_unref)
 
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkPaperSize, gtk_paper_size_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSelectionData, gtk_selection_data_free)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTargetList, gtk_target_list_unref)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTextIter, gtk_text_iter_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeIter, gtk_tree_iter_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeRowReference, gtk_tree_row_reference_free)
index 4dc11b11e6449c36b9677f7f27e33b5800b7133b..8f107cc6c079d54b5583d778a0c70f4319dfb273 100644 (file)
@@ -154,13 +154,6 @@ struct _GtkIncrConversion
                                 *        left to send */
 };
 
-struct _GtkTargetList
-{
-  /*< private >*/
-  GList *list;
-  guint ref_count;
-};
-
 struct _GtkIncrInfo
 {
   GdkWindow *requestor;                /* Requestor window - we create a GdkWindow
@@ -225,85 +218,6 @@ static const char gtk_selection_handler_key[] = "gtk-selection-handlers";
  */
 
 
-/**
- * gtk_target_list_new:
- * @targets: (array length=ntargets) (allow-none): Pointer to an array
- *   of char *
- * @ntargets: number of entries in @targets.
- * 
- * Creates a new #GtkTargetList from an array of mime types.
- * 
- * Returns: (transfer full): the new #GtkTargetList.
- **/
-GtkTargetList *
-gtk_target_list_new (const char **targets,
-                    guint        ntargets)
-{
-  GtkTargetList *result = g_slice_new (GtkTargetList);
-  result->list = NULL;
-  result->ref_count = 1;
-
-  if (targets)
-    gtk_target_list_add_table (result, targets, ntargets);
-  
-  return result;
-}
-
-/**
- * gtk_target_list_ref:
- * @list:  a #GtkTargetList
- * 
- * Increases the reference count of a #GtkTargetList by one.
- *
- * Returns: the passed in #GtkTargetList.
- **/
-GtkTargetList *
-gtk_target_list_ref (GtkTargetList *list)
-{
-  g_return_val_if_fail (list != NULL, NULL);
-
-  list->ref_count++;
-
-  return list;
-}
-
-/**
- * gtk_target_list_unref:
- * @list: a #GtkTargetList
- * 
- * Decreases the reference count of a #GtkTargetList by one.
- * If the resulting reference count is zero, frees the list.
- **/
-void               
-gtk_target_list_unref (GtkTargetList *list)
-{
-  g_return_if_fail (list != NULL);
-  g_return_if_fail (list->ref_count > 0);
-
-  list->ref_count--;
-  if (list->ref_count > 0)
-    return;
-
-  g_list_free (list->list);
-  g_slice_free (GtkTargetList, list);
-}
-
-/**
- * gtk_target_list_add:
- * @list:  a #GtkTargetList
- * @target: the mime type of the target
- * 
- * Appends another target to a #GtkTargetList.
- **/
-void 
-gtk_target_list_add (GtkTargetList *list,
-                    const char    *target)
-{
-  g_return_if_fail (list != NULL);
-  
-  list->list = g_list_append (list->list, (gpointer) gdk_atom_intern (target, FALSE));
-}
-
 static GdkAtom utf8_atom;
 static GdkAtom text_atom;
 static GdkAtom ctext_atom;
@@ -479,134 +393,6 @@ gtk_target_list_add_uri_targets (GtkTargetList *list)
   gtk_target_list_add (list, text_uri_list_atom);  
 }
 
-/**
- * gtk_target_list_merge:
- * @target: the #GtkTargetList to merge into
- * @source: the #GtkTargeList to merge from
- *
- * Merges all targets from @source into @target.
- */
-void
-gtk_target_list_merge (GtkTargetList       *target,
-                       const GtkTargetList *source)
-{
-  GList *l;
-
-  g_return_if_fail (target != NULL);
-  g_return_if_fail (source != NULL);
-
-  for (l = source->list; l; l = l->next)
-    {
-      target->list = g_list_prepend (target->list, l->data);
-    }
-}
-
-/**
- * gtk_target_list_intersects:
- * @first: the primary #GtkTargetList to intersect
- * @second: the #GtkTargeList to intersect with
- *
- * Finds the first element from @first that is also contained
- * in @second.
- *
- * Returns: The first matching #GdkAtom or %NULL if the lists
- *     do not intersect.
- */
-GdkAtom
-gtk_target_list_intersects (const GtkTargetList *first,
-                            const GtkTargetList *second)
-{
-  GList *l;
-
-  g_return_val_if_fail (first != NULL, NULL);
-  g_return_val_if_fail (second != NULL, NULL);
-
-  for (l = first->list; l; l = l->next)
-    {
-      if (g_list_find (second->list, l->data))
-        return l->data;
-    }
-
-  return NULL;
-}
-
-/**
- * gtk_target_list_add_table:
- * @list: a #GtkTargetList
- * @targets: (array length=ntargets): the table of #GtkTargetEntry
- * @ntargets: number of targets in the table
- * 
- * Prepends a table of #GtkTargetEntry to a target list.
- **/
-void               
-gtk_target_list_add_table (GtkTargetList  *list,
-                          const char    **targets,
-                          guint           ntargets)
-{
-  gint i;
-
-  for (i=ntargets-1; i >= 0; i--)
-    {
-      list->list = g_list_prepend (list->list, (gpointer) gdk_atom_intern (targets[i], FALSE));
-    }
-}
-
-/**
- * gtk_target_list_remove:
- * @list: a #GtkTargetList
- * @target: the interned atom representing the target
- * 
- * Removes a target from a target list.
- **/
-void 
-gtk_target_list_remove (GtkTargetList *list,
-                       GdkAtom        target)
-{
-  g_return_if_fail (list != NULL);
-
-  list->list = g_list_remove (list->list, (gpointer) target);
-}
-
-/**
- * gtk_target_list_find:
- * @list: a #GtkTargetList
- * @target: a string representing the target to search for
- *
- * Looks up a given target in a #GtkTargetList.
- *
- * Returns: %TRUE if the target was found, otherwise %FALSE
- **/
-gboolean
-gtk_target_list_find (GtkTargetList *list,
-                     const char    *target)
-{
-  g_return_val_if_fail (list != NULL, FALSE);
-  g_return_val_if_fail (target != NULL, FALSE);
-
-  return g_list_find (list->list, (gpointer) gdk_atom_intern (target, FALSE)) != NULL;
-}
-
-GdkAtom *
-gtk_target_list_get_atoms (GtkTargetList *list,
-                           guint         *n_atoms)
-{
-  GdkAtom *atoms;
-  GList *l;
-  guint i, n;
-
-  n = g_list_length (list->list);
-  atoms = g_new (GdkAtom, n);
-
-  i = 0;
-  for (l = list->list; l; l = l->next)
-    atoms[i++] = l->data;
-
-  if (n_atoms)
-    *n_atoms = n;
-
-  return atoms;
-}
-
 /**
  * gtk_selection_owner_set_for_display:
  * @display: the #GdkDisplay where the selection is set
@@ -2073,7 +1859,6 @@ gtk_targets_include_image (GdkAtom *targets,
                           gboolean writable)
 {
   GtkTargetList *list;
-  GList *l;
   gint i;
   gboolean result = FALSE;
 
@@ -2083,13 +1868,10 @@ gtk_targets_include_image (GdkAtom *targets,
   gtk_target_list_add_image_targets (list, writable);
   for (i = 0; i < n_targets && !result; i++)
     {
-      for (l = list->list; l; l = l->next)
-       {
-         if ((GdkAtom) l->data == targets[i])
-           {
-             result = TRUE;
-             break;
-           }
+      if (gtk_target_list_find (list, targets[i]))
+        {
+          result = TRUE;
+          break;
        }
     }
   gtk_target_list_unref (list);
index ee718e217cae962caec1ca27afccb0aed7c1863b..bc93e9c250f068f2ed57a05b4062d6c895b8f589 100644 (file)
 
 G_BEGIN_DECLS
 
-/**
- * GtkTargetList:
- *
- * A #GtkTargetList-struct is a reference counted list
- * of #GtkTargetPair and should be treated as
- * opaque.
- */
-typedef struct _GtkTargetList  GtkTargetList;
-
 #define GTK_TYPE_SELECTION_DATA (gtk_selection_data_get_type ())
-#define GTK_TYPE_TARGET_LIST    (gtk_target_list_get_type ())
 
-GDK_AVAILABLE_IN_ALL
-GType          gtk_target_list_get_type  (void) G_GNUC_CONST;
-GDK_AVAILABLE_IN_ALL
-GtkTargetList *gtk_target_list_new       (const char          **targets,
-                                          guint                 ntargets);
-GDK_AVAILABLE_IN_ALL
-GtkTargetList *gtk_target_list_ref       (GtkTargetList  *list);
-GDK_AVAILABLE_IN_ALL
-void           gtk_target_list_unref     (GtkTargetList  *list);
-GDK_AVAILABLE_IN_3_94
-void           gtk_target_list_merge     (GtkTargetList         *target,
-                                          const GtkTargetList   *source);
-GDK_AVAILABLE_IN_3_94
-GdkAtom        gtk_target_list_intersects(const GtkTargetList   *first,
-                                          const GtkTargetList   *second);
-GDK_AVAILABLE_IN_ALL
-void           gtk_target_list_add       (GtkTargetList  *list,
-                                          const char     *target);
 GDK_AVAILABLE_IN_ALL
 void           gtk_target_list_add_text_targets      (GtkTargetList  *list);
 GDK_AVAILABLE_IN_ALL
@@ -75,16 +47,6 @@ void           gtk_target_list_add_image_targets     (GtkTargetList  *list,
                                                       gboolean        writable);
 GDK_AVAILABLE_IN_ALL
 void           gtk_target_list_add_uri_targets       (GtkTargetList  *list);
-GDK_AVAILABLE_IN_ALL
-void           gtk_target_list_add_table (GtkTargetList        *list,
-                                          const char          **targets,
-                                          guint                 ntargets);
-GDK_AVAILABLE_IN_ALL
-void           gtk_target_list_remove    (GtkTargetList  *list,
-                                          const char     *target);
-GDK_AVAILABLE_IN_ALL
-gboolean       gtk_target_list_find      (GtkTargetList  *list,
-                                          const char     *target);
 
 GDK_AVAILABLE_IN_ALL
 gboolean gtk_selection_owner_set             (GtkWidget  *widget,